VERSION 5.00
Begin VB.Form frmConnectManager 
   BackColor       =   &H00400000&
   BorderStyle     =   3  'Fixed Dialog
   ClientHeight    =   5100
   ClientLeft      =   45
   ClientTop       =   270
   ClientWidth     =   7680
   BeginProperty Font 
      Name            =   "Verdana"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5100
   ScaleWidth      =   7680
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CheckBox chkWallops 
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   600
      MaskColor       =   &H00400000&
      TabIndex        =   18
      Top             =   4080
      Visible         =   0   'False
      Width           =   2055
   End
   Begin VB.CommandButton cmdConnect 
      Default         =   -1  'True
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   600
      TabIndex        =   7
      Top             =   4560
      Width           =   2895
   End
   Begin VB.CheckBox chkShowConnect 
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   495
      Left            =   3360
      TabIndex        =   17
      Top             =   3240
      Width           =   3615
   End
   Begin VB.CheckBox chkX 
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   600
      TabIndex        =   16
      Top             =   3720
      Visible         =   0   'False
      Width           =   1575
   End
   Begin VB.TextBox txtIdent 
      Height          =   285
      Left            =   1920
      TabIndex        =   6
      Top             =   2760
      Width           =   5175
   End
   Begin VB.CommandButton cmdCancel 
      Appearance      =   0  'Flat
      Cancel          =   -1  'True
      Height          =   375
      Left            =   5400
      TabIndex        =   10
      Top             =   4560
      Width           =   1695
   End
   Begin VB.CommandButton cmdOk 
      Appearance      =   0  'Flat
      Height          =   375
      Left            =   3600
      TabIndex        =   8
      Top             =   4560
      Width           =   1695
   End
   Begin VB.CheckBox chkInvisivel 
      BackColor       =   &H00400000&
      Enabled         =   0   'False
      ForeColor       =   &H00FFFFFF&
      Height          =   255
      Left            =   600
      TabIndex        =   5
      Top             =   3360
      Visible         =   0   'False
      Width           =   1575
   End
   Begin VB.ComboBox cboServer 
      Height          =   315
      Left            =   1920
      Sorted          =   -1  'True
      TabIndex        =   0
      Top             =   1080
      Width           =   3135
   End
   Begin VB.TextBox txtNickName 
      Height          =   285
      Left            =   1920
      TabIndex        =   2
      Top             =   1680
      Width           =   5175
   End
   Begin VB.TextBox txtEMail 
      Height          =   285
      Left            =   1920
      TabIndex        =   3
      Top             =   2040
      Width           =   5175
   End
   Begin VB.TextBox txtMyName 
      Height          =   285
      Left            =   1920
      TabIndex        =   4
      Top             =   2400
      Width           =   5175
   End
   Begin VB.TextBox txtPort 
      Height          =   285
      Left            =   6000
      TabIndex        =   1
      Top             =   1065
      Width           =   1095
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   195
      Left            =   600
      TabIndex        =   9
      Top             =   1080
      Width           =   60
      WordWrap        =   -1  'True
   End
   Begin VB.Label lblIdent 
      AutoSize        =   -1  'True
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   195
      Left            =   600
      TabIndex        =   15
      Top             =   2760
      Width           =   60
      WordWrap        =   -1  'True
   End
   Begin VB.Label Label5 
      AutoSize        =   -1  'True
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   195
      Left            =   600
      TabIndex        =   14
      Top             =   1680
      Width           =   60
      WordWrap        =   -1  'True
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   195
      Left            =   600
      TabIndex        =   13
      Top             =   2040
      Width           =   735
      WordWrap        =   -1  'True
   End
   Begin VB.Label Label3 
      AutoSize        =   -1  'True
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   195
      Left            =   600
      TabIndex        =   12
      Top             =   2400
      Width           =   60
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackColor       =   &H00400000&
      ForeColor       =   &H00FFFFFF&
      Height          =   195
      Left            =   5280
      TabIndex        =   11
      Top             =   1080
      Width           =   615
      WordWrap        =   -1  'True
   End
End
Attribute VB_Name = "frmConnectManager"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

' This file is part of Nightowl.
'
' Nightowl is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.

Public formMode As Byte

 ' Nightowl is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.

' You should have received a copy of the GNU General Public License
' along with Nightowl.  If not, see <http://www.gnu.org/licenses/>.

Private Sub cmdCancel_Click()
    'Unload Me
cmdExit_Click
End Sub

Sub SaveConnect()
SaveSettings
End Sub

Private Sub cmdConnect_Click()
  Dim i As Integer ' index number of server in list to use
  
  If cboServer = "" Or txtPort = "" Or txtMyName = "" Or _
  txtEMail = "" Or txtNickName = "" Or txtIdent = "" Then
    MsgBox lang.Messages(109), vbCritical + vbOKOnly, lang.Messages(20)
    Exit Sub
  End If
  strServer = cboServer
  intPort = txtPort
  Settings.MyName = txtMyName
  Settings.MyMail = txtEMail
 Settings.Nickname = txtNickName
Settings.MyIdent = txtIdent
  
  '+i
  If chkInvisivel.Value = 1 Then
    bInvisible = True
  Else
    bInvisible = False
  End If
  
  '+x
  If chkX.Value = 1 Then
    bHiddenHost = True
  Else
    bHiddenHost = False
  End If
  
  '+w
  If chkWallops.Value = 1 Then
    bWallops = True
  Else
    bWallops = False
  End If
  
  'Hide connection window
  If chkShowConnect.Value = 1 Then
    bShowConnect = True
  Else
    bShowConnect = False
  End If
  
  'Connect to IRC
  bConect = True
  'Write away
  SaveConnect


i = FindIndex(cboServer.List(cboServer.ListIndex))
Unload Me
frmMain.Connect servers(i).address, servers(i).Port
frmMain.MNUServList.Enabled = False
frmMain.MNUDisconnect.Enabled = True
frmMain.Show
  
  End Sub

Private Sub cmdOK_Click()
  'Write away
  SaveConnect
Unload Me
FrmServerList.Show vbModal, frmMain
End Sub

Private Sub Form_Load()
                    
                    SetCaptions
                    ' cmdConectar.Enabled = False
          txtPort = 6667
  txtMyName = Settings.MyName
  txtEMail = Settings.MyMail
  txtNickName = Settings.Nickname
    txtIdent = Settings.MyIdent
  chkInvisivel.Value = TF(bInvisible)
  chkX.Value = TF(bHiddenHost)
  chkWallops.Value = TF(bWallops)
  chkShowConnect.Value = TF(bShowConnect)

If LoadServerList(ServerListFile) <> 1 Then
AddServers
End If
    
      
End Sub

Public Sub AddServers()
Dim i As Byte
cboServer.Clear

For i = LBound(servers) To UBound(servers)
cboServer.AddItem servers(i).sName
Next i
cboServer.ListIndex = 0

End Sub

Private Function FindIndex(ByVal ServString As String) As Integer
Dim i As Byte

If ArrayInitialised(ArrPtr(servers)) Then
For i = LBound(servers) To UBound(servers)
If servers(i).sName = ServString Then
FindIndex = i
Exit Function
End If
Next i
FindIndex = -1
Else
FindIndex = -1
End If

End Function

Private Sub cmdExit_Click()
Select Case formMode
  Case 0, 1
    Unload frmMain
    Unload Me
    End
  Case 2, 3
    Unload Me
End Select

End Sub

Private Sub SetCaptions()

frmConnectManager.Caption = lang.Messages(101)
Label1.Caption = lang.Messages(102)
Label2.Caption = lang.Messages(103)
Label3.Caption = lang.Messages(104)
Label4.Caption = lang.Messages(105)
Label5.Caption = lang.Messages(106)
lblIdent.Caption = lang.Messages(107)
cmdConnect.Caption = lang.Buttons(19)
cmdOk.Caption = lang.Buttons(22)
cmdCancel.Caption = lang.Buttons(1)
chkX.Caption = lang.Buttons(23)
chkWallops.Caption = lang.Buttons(24)
chkShowConnect.Caption = lang.Buttons(21)
chkInvisivel.Caption = lang.Buttons(25)

End Sub

Private Sub txtnickname_Change()
'Generate automatic Ident based on the Client and the Nick
txtIdent.Text = GenerateIdent(txtNickName.Text)
End Sub

